﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using M3G;

namespace MyTestProject {

    public class TestPolygonMode {
        [Fact]
        public void TestConstructor () {
            var pmode = new PolygonMode ();

            Assert.Equal (PolygonMode.CullBack, pmode.Culling);
            Assert.Equal (PolygonMode.WindingCCW, pmode.Winding);
            Assert.Equal (1.0f, pmode.LineWidth);
            Assert.Equal (true, pmode.PerspectiveCorrectionEnabled);
        }

        [Fact]
        public void TestSetCulling () {
            var pmode = new PolygonMode ();
            pmode.Culling = PolygonMode.CullNone;

            Assert.Equal (PolygonMode.CullNone, pmode.Culling);
        }

        [Fact]
        public void TestSetLineWidth () {
            var pmode = new PolygonMode ();
            pmode.LineWidth = 2.0f;

            Assert.Equal (2.0f, pmode.LineWidth);
        }

        [Fact]
        public void TestWinding () {
            var pmode = new PolygonMode ();
            pmode.Winding = PolygonMode.WindingCW;

            Assert.Equal (PolygonMode.WindingCW, pmode.Winding);
        }

        [Fact]
        public void TestSetPerspectiveEnabled () {
            var pmode = new PolygonMode ();
            pmode.PerspectiveCorrectionEnabled = true;

            Assert.Equal (true, pmode.PerspectiveCorrectionEnabled);
        }

        [Fact]
        public void TestDuplicate () {
            var pmode = new PolygonMode ();
            pmode.Culling = PolygonMode.CullNone;
            pmode.Winding = PolygonMode.WindingCW;
            pmode.LineWidth = 2.0f;
            pmode.PerspectiveCorrectionEnabled = true;
            pmode.UserID = 100;

            var dup = (PolygonMode)pmode.Duplicate ();

            Assert.Equal (pmode.Culling, pmode.Culling);
            Assert.Equal (pmode.Winding, pmode.Winding);
            Assert.Equal (pmode.LineWidth, pmode.LineWidth);
            Assert.Equal (pmode.PerspectiveCorrectionEnabled, pmode.PerspectiveCorrectionEnabled);
            Assert.Equal (pmode.UserID, dup.UserID);

        }

    }
}
